import Base from "./base.js";
import { pieOption } from "./options";
import { deepClone } from "./utils";
import "echarts/src/chart/pie"; //饼状

function barInitData(datas) {
    if (!(datas instanceof Array)) throw new Error("initData 请传入 数组");
    datas.forEach(data => {
        data.type = "pie";
    });
}

export default class Bar extends Base {
    constructor(dom, initData, xAxisData = [], newOption = {}) {
        let newInitData = deepClone(initData);
        barInitData(newInitData);
        super(dom, newInitData, xAxisData, pieOption, newOption);
    }
}
